function recursionRoutes(allRoutes = [], menuList = []) {
    let userRoutes = [];
    // console.log(allRoutes)
    //遍历allRoute 对比的条件就是 找menList中 title和 allRoutes中每个route对象中的meta属性中的title相同的选项,如果相同,说明需要这个route对象,那就添加到数组中userRoutes

    menuList.forEach(item => {
        allRoutes.forEach(route => {
            if (route.meta?.title === item.title) {
                route.meta.name = item.name //将菜单的名字映射到路由对象中
                if (route.children && route.children.length > 0) {
                    route.children = recursionRoutes(route.children, item.children)
                }
                userRoutes.push(route)
            }
        })
    })

    return userRoutes
}

export default recursionRoutes
